<template>
  <i class="my-icon" :class="{
    [`my-icon--${type}`]: type
  }" :style="customStyles" v-bind="$attrs">
    <font-awesome-icon v-bind="fileteredProps" />
  </i>
</template>

<script setup lang="ts">
import { omit } from 'lodash-es'
import type { IconProps } from './types'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { computed } from 'vue'
defineOptions({
  name: 'MyIcon',
  inheritAttrs: false
})
const props = defineProps<IconProps>()
const fileteredProps = computed(() => omit(props, ['type', 'color']))
const customStyles = computed(() => {
  return props.color ? { color: props.color } : {}
})
</script>

<style scoped></style>